 #include "debug.h"


#include "task_sys.h"
#include "task_uart.h"

/**********************************************************************************************************
任务优先级数值越小，任务优先级越低
**********************************************************************************************************/
static void AppTaskCreate (void)
{
	xTaskCreate( vTask_Sys, 	 		"vTask_Sys",   	100,  NULL,  4, &xHandleTaskSys );   
	xTaskCreate( vTask_uart, 	 		"vTask_uart",   200,  NULL,  4, &xHandleTaskUART );   
}



/**********************************************************************************************************
主程序
**********************************************************************************************************/
int main(void)
{
	// 延时等待系统稳定
	int t=5000000; while(t--);

	SYS_Init(); 

	AppTaskCreate();

	vTaskStartScheduler();

	while(1)
	{
	
	}
}





/*
TickType_t sysTime = xTaskGetTickCount();   // 单位 ms

	static void AppTaskCreate( void *pvParameters )
{
	//xQueueHandle mavlinkQueue;
	//mavlink_message_t msg;
	//mavlinkQueue = xQueueCreate(20,sizeof(mavlink_message_t));
	//xQueueSendToBack(mavlinkQueue, &msg, MAVLINK_WAIT);
	//xQueueReceive( mavlinkQueue, &msg, portMAX_DELAY );
	//mavlink_send_with_dma(&msg);
	xTaskGetTickCount( void );
	
	//xSemaphoreHandle xMavlinkSendBinarySemaphore;
	//xSemaphoreHandle xMavlinkReceiveBinarySemaphore;

	//vSemaphoreCreateBinary(xMavlinkSendBinarySemaphore);
	//vSemaphoreCreateBinary(xMavlinkReceiveBinarySemaphore);
	
	//xSemaphoreGiveFromISR( xMavlinkSendBinarySemaphore, &xHigherPriorityTaskWoken );  //chufa 
	
	//xSemaphoreTake(xMavlinkReceiveBinarySemaphore, portMAX_DELAY );   // 
	//mavlink_message_t msg;
  while(1)
	{
		//xSemaphoreTake(xMavlinkSendBinarySemaphore, portMAX_DELAY );  //
	  
		
		//printf("%d\r\n",(int)uxQueueMessagesWaiting(mavlinkQueue));
		
		//mavlink_send_with_dma(&msg);
	}
	 vTaskDelete(NULL);
}
*/
